<?php

namespace common\validate;


class Project extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this;
//        return $this->append('data.media', 'require|array')
//            ->append('data.project.name', 'require|max:128')
//            ->append('data.project.code', 'max:128')
//            ->append('data.project.public', 'in:yes,no')
//            ->append('data.project.is_demo', 'in:yes,no')
//            ->append('data.project.project_template_id', 'require')
//            ->append('data.project.rate', 'max:6')
//            ->append('data.project.start_time', 'date')
//            ->append('data.project.end_time', 'date')
//            ->append('data.project.duration', 'max:8')
//            ->append('data.project.resolution', 'max:128')
//            ->append('data.project.delivery_time', 'date')
//            ->append('data.project.episodes', 'max:6');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.step_category_id', 'integer')
            ->append('data.name', 'max:128')
            ->append('data.code', 'max:128')
            ->append('data.plan_resource', 'max:10|integer|elt:4294967295');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // GetList 验证场景定义
    public function sceneGetList()
    {
        return $this
            ->append("param.project_status", 'require|in:inprogress,history,total,not_started,blocked,done')
            ->append("param.filter_role_resource_by_project_member", 'in:yes,no')
            ->append("param.page", 'array');
    }

    // GetTeamUserProjectList 验证场景定义
    public function sceneGetTeamUserProjectList()
    {
        return $this
            ->append("param.project_status", 'require|in:inprogress,history,total')
            ->append("param.user_id", 'require|integer')
            ->append("param.page", 'array');
    }

    // BaseSelect 验证场景定义
    public function sceneBaseSelect()
    {
        return $this->append('param', 'require');

    }

    // SetFastFlow 验证场景定义
    public function sceneSetFastFlow()
    {
        return $this->append("data.id", "require|integer|min:1")
            ->append("data.fast_workflow", "require|in:yes,no");
    }

    // GetEpisodeList 验证获取集数列表定义
    public function sceneGetEpisodeList()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.episode_status', 'require|in:all,inprogress,done')
            ->append('param.count_type', 'require|in:none,script_up')
            ->append('param.page', 'array')
            ->append('param.only_show_responsible', 'in:no,yes')
            ->append('param.only_show_responsible_filter ', 'in:none,episode_allocation');
    }

    // GetShowingNumberListByEpisode 验证获取指定集数场次列表定义
    public function sceneGetShowingNumberListByEpisode()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.episode_id', 'require|integer');
    }

    // GetModuleFieldRuleSetting 验证场景定义
    public function sceneGetModuleFieldRuleSetting()
    {
        return $this->append('param.filter.project_id', 'require');
    }

    // TaskDoneCount 验证场景定义
    public function sceneTaskDoneCount()
    {
        return $this
            ->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.episode_id', 'integer')
            ->append('param.filter.module_code', 'require|in:shot,asset')
            ->append('param.filter.step_category_id_list', 'array')
            ->append('param.filter.count_type', 'in:step,entity');
    }

    // CopyProjectTemplateRelateConfig 验证场景定义
    public function sceneCopyProjectTemplateRelateConfig()
    {
        return $this->append('param.project_id', 'require|integer');
    }

    // SelectProjectReviewRelationTree 验证场景定义
    public function sceneSelectProjectReviewRelationTree()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.filter', 'require|array');
    }

    // SaveProjectReviewRelation 验证场景定义
    public function sceneSaveProjectReviewRelation()
    {
        return $this->append('project_id', 'require|integer')
            ->append('data_list', 'require|array');
    }

    // SaveProjectReviewRelationItem 验证场景定义
    public function sceneSaveProjectReviewRelationItem()
    {
        return $this
            ->append('project_id', 'require|integer')
            ->append('step_workflow_id', 'require|integer')
            ->append('step_id', 'require|integer')
            ->append('attr_str', 'length:0,256');
    }

    // SelectProjectStepWorkflowReviewRelationTree 验证场景定义
    public function sceneSelectProjectStepWorkflowReviewRelationTree()
    {
        return $this
            ->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_workflow_id', 'require|integer');
    }

    // SaveCheckListRoleCode 验证场景定义
    public function sceneSaveCheckListRoleCode()
    {
        return $this
            ->append('data_list', 'require|array')
            ->append('project_id', 'require|integer');
    }

    // SaveCheckListRoleCodeItem 验证场景定义
    public function sceneSaveCheckListRoleCodeItem()
    {
        return $this
            ->append('id', 'require|integer')
            ->append('review_role_config', 'length:0,256');
    }

    // SaveAllReviewData 验证场景定义
    public function sceneSaveAllReviewData()
    {
        return $this
            ->append('check_list_role_data', 'array')
            ->append('review_relation_data', 'array')
            ->append('project_id', 'require|integer');
    }

    // SelectDelayReviewRelation 验证场景定义
    public function sceneSelectDelayReviewRelation()
    {
        return $this
            ->append('param.filter', 'array')
            ->append('param.filter.project_id', 'integer')
            ->append('param.filter.step_category_id', 'integer');
    }

    // SaveDelayReviewData 验证场景定义
    public function sceneSaveDelayReviewData()
    {
        return $this
            ->append('data', 'array')
            ->append('data.step_category_id', 'integer')
            ->append('data.review_workflow_id', 'integer')
            ->append('data.project_id', 'integer');
    }

    // ScanExistDataToProjectMember 验证场景定义
    public function sceneScanExistDataToProjectMember()
    {
        return $this->append('param.project_id', 'require|integer');
    }

    public function sceneProjectConfigCheck()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    public function sceneAddProjectEpisode()
    {
        return $this->append('data.episode', 'require|array')
            ->append('data.project_id', 'require|integer');
    }

    public function sceneDeleteProjectEpisode()
    {
        return $this->append('param.filter.project_id', 'require');
    }

    public function sceneProjectEpisodeTree()
    {
        return $this->append('param.filter', 'array');
    }

    // SelectProduceResources 验证场景定义
    public function sceneSelectProduceResources()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // SelectProduceResourcesDistributed 验证场景定义
    public function sceneSelectProduceResourcesDistributed()
    {
        return $this->append('param.filter.id', 'require|integer');
    }

    // GetScoreAndErrorMessage 验证场景定义
    public function sceneGetScoreAndErrorMessage()
    {
        return $this->append('param.project_id', 'require|integer');
    }

    // GetShowStepCategoryList 验证场景定义
    public function sceneGetShowStepCategoryList()
    {
        return $this->append('param.project_id', 'integer');
    }

    // GetPCConfig 验证场景定义
    public function sceneGetPCConfig()
    {
        return $this->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_category_id_list', 'require|array');
    }

    // SavePCConfig 验证场景定义
    public function sceneSavePCConfig()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.step_category_id_list', 'require|array')
            ->append('param.config', 'require|array');
    }

    // EpisodeShowingNumberTree 验证场景定义
    public function sceneEpisodeShowingNumberTree()
    {
        return $this->append('param.filter.project_id', 'require')
            ->append('param.episode_chunk_size', 'require|integer');
    }
}
